package com.amt.basic.service.impl;

import com.amt.basic.config.WeiMengApiConfig;
import com.amt.basic.config.WeiMengConfig;
import com.amt.basic.service.TestService;
import com.amt.util.HttpUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TestServiceImpl implements TestService {

    @Autowired
    private WeiMengApiConfig weiMengApiConfig;

    @Autowired
    private WeiMengConfig weiMengConfig;

    @Override
    public String getToken() {
        String url = weiMengApiConfig.getGetToken()+"grant_type=client_credentials" + "&client_id=" + weiMengConfig.getClientId() + "&client_secret=" +
                weiMengConfig.getClientSecret() + "&shop_id=" + weiMengConfig.getShopId() + "&shop_type=" + weiMengConfig.getShopType();
        String s = HttpUtil.requestPost(url);
        System.out.println(s);
        return s;
    }
}
